Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch available incentives after linking bank account #9735

Merged
merged 6 commits into from
Jan 13, 2025

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Dec 4, 2024

Summary

This pull request adds a call to consumers/incentives/update_available at the end of the Instant Bank Payments flow. This endpoint doesn’t return any available incentives yet, but will do so soon.

Depending on the response, we return eligibleForIncentive: Boolean to the MPE. With a future pull request, it’ll update the payment methods list based on the response.

Motivation

CONSUMERBANK-564

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

Copy link
Contributor

github-actions bot commented Dec 4, 2024

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │          uncompressed          
          ├───────────┬───────────┬──────────┼──────────┬──────────┬──────────
 APK      │ old       │ new       │ diff     │ old      │ new      │ diff     
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
      dex │   3.9 MiB │   3.9 MiB │ +1.1 KiB │  8.6 MiB │  8.6 MiB │ +2.7 KiB 
     arsc │   2.3 MiB │   2.3 MiB │      0 B │  2.3 MiB │  2.3 MiB │      0 B 
 manifest │   5.1 KiB │   5.1 KiB │      0 B │ 25.2 KiB │ 25.2 KiB │      0 B 
      res │ 908.4 KiB │ 908.4 KiB │      0 B │  1.4 MiB │  1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │    6 MiB │    6 MiB │      0 B 
    asset │   1.6 MiB │   1.6 MiB │    -25 B │  1.6 MiB │  1.6 MiB │    -25 B 
    other │   1.4 MiB │   1.4 MiB │    +11 B │  1.6 MiB │  1.6 MiB │      0 B 
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
    total │  12.6 MiB │  12.6 MiB │ +1.1 KiB │ 21.5 MiB │ 21.5 MiB │ +2.7 KiB 

 DEX     │ old   │ new   │ diff            
─────────┼───────┼───────┼─────────────────
   files │     1 │     1 │   0             
 strings │ 40689 │ 40698 │  +9 (+25 -16)   
   types │ 14036 │ 14040 │  +4 (+19 -15)   
 classes │ 11708 │ 11711 │  +3 (+4 -1)     
 methods │ 59678 │ 59691 │ +13 (+322 -309) 
  fields │ 39870 │ 39884 │ +14 (+278 -264) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  243 │  243 │  0   
 entries │ 6209 │ 6209 │  0
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.9 MiB │ +1.1 KiB │   8.6 MiB │ +2.7 KiB │ ∆ classes.dex                  
  7.8 KiB │    -26 B │   7.7 KiB │    -26 B │ ∆ assets/dexopt/baseline.prof  
 53.5 KiB │     +6 B │ 118.7 KiB │      0 B │ ∆ META-INF/CERT.SF             
 50.3 KiB │     +6 B │ 118.6 KiB │      0 B │ ∆ META-INF/MANIFEST.MF         
    998 B │     +1 B │     866 B │     +1 B │ ∆ assets/dexopt/baseline.profm 
  1.2 KiB │     -1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA            
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
    4 MiB │ +1.1 KiB │   8.8 MiB │ +2.7 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   40689 │ 40698 │ +9 (+25 -16) 
  
  + LO6/s3;
  + Ld8/f;
  + Lh6/M;
  + Lh8/k;
  + UpdateAvailableIncentives(data=
  + [LO6/s3;
  + [LT6/m;
  + [LT6/o;
  + [LZ5/h;
  + [La6/Q0;
  + [Landroidx/recyclerview/widget/C0;
  + [Lf7/i;
  + [Lh6/I;
  + [Lh6/L;
  + [Lh6/r;
  + [Lh8/i;
  + [Lh8/k;
  + [Li3/h;
  + [Ll8/s;
  + [Lv5/n;
  + consumers/incentives/update_available
  + incentive_display_text
  + incentive_params
  + link_consumer_incentive
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"800cd45","r8-mode":"full","version":"8.7.14"}
  
  - Li3/i;
  - [LT6/l;
  - [LT6/n;
  - [LZ5/g;
  - [La6/P0;
  - [Landroidx/recyclerview/widget/B0;
  - [Lf7/h;
  - [Lh6/H;
  - [Lh6/K;
  - [Lh6/q;
  - [Lh8/h;
  - [Lh8/j;
  - [Li3/i;
  - [Ll8/r;
  - [Lv5/m;
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"695280e","r8-mode":"full","version":"8.7.14"}
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   14036 │ 14040 │ +4 (+19 -15) 
  
  + LO6/s3;
  + Ld8/f;
  + Lh6/M;
  + Lh8/k;
  + [LO6/s3;
  + [LT6/m;
  + [LT6/o;
  + [LZ5/h;
  + [La6/Q0;
  + [Landroidx/recyclerview/widget/C0;
  + [Lf7/i;
  + [Lh6/I;
  + [Lh6/L;
  + [Lh6/r;
  + [Lh8/i;
  + [Lh8/k;
  + [Li3/h;
  + [Ll8/s;
  + [Lv5/n;
  
  - Li3/i;
  - [LT6/l;
  - [LT6/n;
  - [LZ5/g;
  - [La6/P0;
  - [Landroidx/recyclerview/widget/B0;
  - [Lf7/h;
  - [Lh6/H;
  - [Lh6/K;
  - [Lh6/q;
  - [Lh8/h;
  - [Lh8/j;
  - [Li3/i;
  - [Ll8/r;
  - [Lv5/m;
  

METHODS:

   old   │ new   │ diff            
  ───────┼───────┼─────────────────
   59678 │ 59691 │ +13 (+322 -309) 
  
  + A5.B <init>(H)
  + A5.C0 <init>(Z, G, a)
  + A5.H0 <init>(Locale, a, d, M, G, i)
  + A5.J0 <init>(t)
  + A5.J <init>(G, a, String)
  + A5.K <init>(G, a)
  + A5.M0 <init>(a, M, i)
  + A5.M <init>(q, a)
  + A5.N0 <init>(q)
  + A5.O a(String, String, r3, d, o, p, q, r, c) → Object
  + A5.P0 <init>(G)
  + A5.Q <init>(G, a)
  + A5.S <init>(G, a)
  + A5.a <init>(G, a)
  + A5.e0 <init>(i, K, d, a)
  + A5.f <init>(Z, G, a)
  + A5.i <init>(Z, G, a)
  + A5.l <init>(H, B, a)
  + A5.o0 <init>(H, a)
  + A5.q0 <init>(G, d, a)
  + A5.r <init>(q)
  + A5.r c(Throwable, r3) → Throwable
  + A5.s0 <init>(G, a, String)
  + A5.t0 <init>(q, a)
  + A5.t <init>(G, a)
  + A5.u <init>(t)
  + A5.v0 <init>(q, H, K, e)
  + A5.x0 <init>(s, v, d, E)
  + A5.y <init>(H)
  + C5.J <init>(p, Z, v, K, H0, K0, J, E, p, d, j0, p)
  + E5.e <init>(b, Z, M, e0, v, D, E, J, d)
  + I4.m <init>(i)
  + J5.h <init>(d, Z, J, s, v, E, d)
  + K7.s a(s, z)
  + N5.w <init>(k, Z, v, K, p, z, M0, O0, J, E, d, a, p)
  + O5.r <init>(f, Z, v, J, N0, K, r, M0, D, Q, E, d)
  + O6.h3 <init>(s3)
  + O6.p3 <init>(ArrayList)
  + O6.p3 describeContents() → int
  + O6.p3 equals(Object) → boolean
  + O6.p3 hashCode() → int
  + O6.p3 toString() → String
  + O6.p3 writeToParcel(Parcel, int)
  + O6.r2 <init>(String, Long, String, m2, Long, String, Source_Flow, Boolean, o2, p2, q2, Source_Status, Map, I2, String, String, Source_Usage, s3, n2, w2, String)
  + O6.r3 <init>(String, int, String)
  + O6.r3 valueOf(String) → r3
  + O6.r3 values() → r3[]
  + O6.s3 <clinit>()
  + O6.s3 <init>(String, String, String, String, String, String, String, String, String)
  + O6.s3 describeContents() → int
  + O6.s3 equals(Object) → boolean
  + O6.s3 hashCode() → int
  + O6.s3 toString() → String
  + O6.s3 writeToParcel(Parcel, int)
  + P.u <init>(B, H)
  + P5.v <init>(m, Z, e0, M, O0, v, J, E, d)
  + P6.a h(JSONObject) → w
  + P6.f a(JSONObject) → u2
  + P6.f b(JSONObject) → w2
  + Q5.c <init>(a, J, M, v, Z)
  + R4.p R(x, a, r) → n
  + S5.c <init>(q, t0, J, E, x0)
  + T5.s <init>(f, Z, J, r, S, E, v, O, d, z0, t0, K, x0)
  + T6.A <init>(z)
  + T6.B <init>(n)
  + T6.C <clinit>()
  + T6.C equals(Object) → boolean
  + T6.C hashCode() → int
  + T6.C toString() → String
  + T6.E <init>(Object, Object, Object, Object, Object, int)
  + T6.E a() → Object
  + T6.F <init>(j3, Z, g)
  + T6.G <init>(Throwable, c, w)
  + T6.G equals(Object) → boolean
  + T6.G hashCode() → int
  + T6.G toString() → String
  + T6.H <init>(E, boolean)
  + T6.J <init>(n, e, g)
  + T6.L a(n, e, c) → Object
  + T6.O <init>(String, n, boolean)
  + T6.V <init>(W, m, d)
  + T6.W a(W, m, c) → Object
  + T6.W c(z)
  + T6.W e(m)
  + T6.b <init>(Throwable, c, w)
  + T6.f <init>(o)
  + T6.g <init>(Throwable, c, w)
  + T6.k a(Object, Object, n, e)
...✂

@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-fetch-available-incentives branch from 33dc828 to 9ae1eba Compare December 4, 2024 13:12
@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-bank-form-badge branch 2 times, most recently from b07a81e to 99bd861 Compare December 5, 2024 20:51
Base automatically changed from tillh/ibp-incentives-bank-form-badge to master December 5, 2024 21:11
@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-fetch-available-incentives branch 4 times, most recently from ac04a94 to 2d0ba4c Compare December 9, 2024 16:56
@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-fetch-available-incentives branch 3 times, most recently from fe65708 to bff3c83 Compare December 16, 2024 17:09
@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-fetch-available-incentives branch from a425769 to 29a3cb6 Compare January 10, 2025 14:36
@tillh-stripe tillh-stripe force-pushed the tillh/ibp-incentives-fetch-available-incentives branch from 29a3cb6 to 132e90a Compare January 10, 2025 15:47
@tillh-stripe tillh-stripe marked this pull request as ready for review January 10, 2025 17:09
@tillh-stripe tillh-stripe requested review from a team as code owners January 10, 2025 17:09
consumerSessionClientSecret = consumerSessionClientSecret,
requestSurface = requestSurface,
requestOptions = provideApiRequestOptions(useConsumerPublishableKey = true),
).getOrThrow()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more argument against returning Results -> many times we're forced to unwrap them so that caller can runCatch reliably.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, my bad. I’ll propagate the Result<T> to the call-site. This works here because we’re not using suspend { … } directly, which sort of wants us to throw.

@tillh-stripe tillh-stripe merged commit b67e9c7 into master Jan 13, 2025
16 checks passed
@tillh-stripe tillh-stripe deleted the tillh/ibp-incentives-fetch-available-incentives branch January 13, 2025 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants